<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>小星星</title>
    <script>
        function xin() {
            while (1) {
                let un = prompt("请输入层高");
                //判断整数
                if (un % 1 !== 0) {
                    alert("请输入整数");
                    continue;
                    //判断正数
                } else if (un <= 0) {
                    alert("层高必须大于0");
                    continue;
                } else {
                    for (let i = 0; i < un; i++) {
                        for (let l = 0; l <= i; l++) {
                            document.write("$")
                        }
                        document.write("<br />")
                    }
                }
                break;//退出w循环
            } //while结束
        }//f结束
        xin()
    </script>

</head>
<body>

</body>
</html>